import React from 'react';
import { Button, Divider, Space, Table, Tag } from 'antd';

const { Column, ColumnGroup } = Table;


interface SearchtableProps {
  total:number,
  dataSource: DataType[];
  onPageChange: (current: number, pageSize?: number) => void;
}

const handleStatusChange = (orderId: string, newStatus: string) => {
  // Add your logic to handle status change here
  console.log(`Changing status of order ${orderId} to ${newStatus}`);
};
export const Searchtable: React.FC<SearchtableProps> = ({ dataSource, onPageChange,total }) => (
  <Table  bordered={true}  pagination={{
        total
      }} dataSource={dataSource} onChange={(pagination) => onPageChange(pagination.current || 1, pagination.pageSize)}>
    <Column title="商品名称" dataIndex="fileName" key="fileName" />

    <Column title="商品信息" dataIndex="title" key="title" />

    
    <Column title="创建时间" dataIndex="createTime" key="createTime" />

    {/* <Column title="注册时间" dataIndex="price" key="price" /> */}
    {/* <Column title="订单号" dataIndex="orderNumber" key="orderNumber" />
    <Column title="总价" dataIndex="actualTotal" key="actualTotal" />
    <Column title="订单状态" dataIndex="status" key="status" /> */}
    <Column
      title="操作"
      dataIndex="tags"
      key="tags"
      render={(tags, record: any) => (
        <div className="space-x-4">
          <Button type="primary" onClick={() => handleStatusChange(record, 'newStatus')}>
            添加消息
          </Button>

          <Button type="primary" onClick={() => handleStatusChange(record, 'newStatus')}>
            查看
          </Button>

        </div>

      )}
    />,


    {/* <Column
      title="Tags"
      dataIndex="tags"
      key="tags"
      render={(tags: string[]) => (
        <>
          {tags.map((tag) => (
            <Tag color="blue" key={tag}>
              {tag}
            </Tag>
          ))}
        </>
      )}
    />
    <Column
      title="Action"
      key="action"
      render={(_: any, record: DataType) => (
        <Space size="middle">
          <a>Invite {record.lastName}</a>
          <a>Delete</a>
        </Space>
      )}
    /> */}
  </Table>
);

